/*
 * Google code jam: GoroSort
 * 
 * Author: Jim
 * Date: 2011-05-07 Sat.
 */

#include <iostream>
#include <cstdlib>
#include <stdio.h>
#include <string.h>
#include <vector>

using namespace std;
  
#define DEBUG 1
void solve();

int main(int argc, char** argv)
{
    int n;

#if DEBUG
    if(argc != 2)
    {
	cout << "please type -s or -l select large or small input data" << endl;
	return 1;
    }
    if(strcmp(argv[1], "-s") == 0)
    {
	freopen("D-small-practice.in","r",stdin); 
    }
    else if(strcmp(argv[1], "-l") == 0)
    {
	freopen("D-large-practice.in","r",stdin); 
    }
    else
    {
	cout << "please type -s or -l select large or small input data" << endl;
	return 1;
    }
#else
    freopen("D-small-practice.in","r",stdin); 
#endif
    freopen("output.txt","w",stdout); 

    //Add Your Code Here
    cin >> n;
    for(int i=0; i<n; i++)
    {
        cout <<"Case #"<<i+1<<": ";
        solve();
    }


    fclose(stdin);
    fclose(stdout);

    return EXIT_SUCCESS;
}


void solve()
{
    int count = 0;
    vector<int> a;
    int x;
    cin >> x;
    for(int i=0; i<x; i++)
    {
	int y;
	cin >> y;
	a.push_back(y);
    }

    for(int i=0; i<x; i++)
    {
	if(a[i] != i+1)
	{
	    count++;
	}
    }
    double res = count;
    printf("%f\n", res);
}


